xlat: Fix compatibility between v1 and v2
authorAntonio Nino Diaz <[email protected]>
Fri, 19 Oct 2018 15:52:22 +0000 (16:52 +0100)
committerAntonio Nino Diaz <[email protected]>
Fri, 26 Oct 2018 13:55:30 +0000 (14:55 +0100)
There are several platforms using arm_setup_page_tables(), which is
supposed to be Arm platform only. This creates several dependency
problems between platforms.

This patch adds the definition XLAT_TABLES_LIB_V2 to the xlat tables lib
v2 makefile. This way it is possible to detect from C code which version
is being used and include the correct header.

The file arm_xlat_tables.h has been renamed to xlat_tables_compat.h and
moved to a common folder. This way, when in doubt, this header can be
used to guarantee compatibility, as it includes the correct header based
on XLAT_TABLES_LIB_V2.

This patch also removes the usage of ARM_XLAT_TABLES_V1 from QEMU (so
that is now locked in xlat lib v2) and ZynqMP (where it was added as a
workaround).

Change-Id: Ie1e22a23b44c549603d1402a237a70d0120d3e04
Signed-off-by: Antonio Nino Diaz <[email protected]>
13 files changed:
include/lib/xlat_tables/xlat_tables_compat.h [new file with mode: 0644]
include/plat/arm/board/common/v2m_def.h
include/plat/arm/common/arm_xlat_tables.h [deleted file]
include/plat/arm/common/plat_arm.h
lib/xlat_tables_v2/xlat_tables.mk
plat/arm/board/fvp/fvp_common.c
plat/arm/common/arm_bl1_setup.c
plat/arm/common/arm_bl31_setup.c
plat/arm/common/arm_common.c
plat/common/plat_bl_common.c
plat/qemu/platform.mk
plat/qemu/qemu_common.c
plat/xilinx/zynqmp/platform.mk

diff --git a/include/lib/xlat_tables/xlat_tables_compat.h b/include/lib/xlat_tables/xlat_tables_compat.h
new file mode 100644 (file)
index 0000000..4650a8c
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#if XLAT_TABLES_LIB_V2
+#include <xlat_tables_v2.h>
+#else
+#include <xlat_tables.h>
+#endif
index 02c349418fd0eba9e19c976bb21619963bcd96e1..4a1d43c8501c49bfd2a2d61454e09632a6f3e2f9 100644 (file)
@@ -6,8 +6,7 @@
 #ifndef V2M_DEF_H
 #define V2M_DEF_H
 
-#include <arm_xlat_tables.h>
-
+#include <xlat_tables_compat.h>
 
 /* V2M motherboard system registers & offsets */
 #define V2M_SYSREGS_BASE               UL(0x1c010000)
diff --git a/include/plat/arm/common/arm_xlat_tables.h b/include/plat/arm/common/arm_xlat_tables.h
deleted file mode 100644 (file)
index 0923ad8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#if ARM_XLAT_TABLES_LIB_V1
-#include <xlat_tables.h>
-#else
-#include <xlat_tables_v2.h>
-#endif /* ARM_XLAT_TABLES_LIB_V1 */
index 773c3603e92d366e3963193bf666c32258302a43..b93381ddb2dda7b5940813c0cfea02ac22c70587 100644 (file)
@@ -6,7 +6,6 @@
 #ifndef __PLAT_ARM_H__
 #define __PLAT_ARM_H__
 
-#include <arm_xlat_tables.h>
 #include <bakery_lock.h>
 #include <cassert.h>
 #include <cpu_data.h>
@@ -14,6 +13,7 @@
 #include <spinlock.h>
 #include <tzc_common.h>
 #include <utils_def.h>
+#include <xlat_tables_compat.h>
 
 /*******************************************************************************
  * Forward declarations
index 9507ad7155f92a263e6155bb500de688f7a251e5..c946315bf8294d6454d9b0343dd57dc66fe58055 100644 (file)
@@ -10,3 +10,6 @@ XLAT_TABLES_LIB_SRCS  :=      $(addprefix lib/xlat_tables_v2/,        \
                                xlat_tables_context.c                   \
                                xlat_tables_core.c                      \
                                xlat_tables_utils.c)
+
+XLAT_TABLES_LIB_V2     :=      1
+$(eval $(call add_define,XLAT_TABLES_LIB_V2))
index aa4f8398de776581d3a2e42e19704a2e3164e785..836fd93f3d0fd7a97d9d7ba5d10b786ff255841d 100644 (file)
@@ -7,7 +7,6 @@
 #include <arm_config.h>
 #include <arm_def.h>
 #include <arm_spm_def.h>
-#include <arm_xlat_tables.h>
 #include <assert.h>
 #include <cci.h>
 #include <ccn.h>
@@ -18,6 +17,8 @@
 #include <platform.h>
 #include <secure_partition.h>
 #include <v2m_def.h>
+#include <xlat_tables_compat.h>
+
 #include "../fvp_def.h"
 #include "fvp_private.h"
 
index 717e96f8548bc8b2d3d8a60918c41b7d53c6fc0e..d67c0c275a9319558b22eab9765b981115b690ff 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <arch.h>
 #include <arm_def.h>
-#include <arm_xlat_tables.h>
 #include <assert.h>
 #include <bl1.h>
 #include <bl_common.h>
@@ -15,6 +14,8 @@
 #include <platform_def.h>
 #include <sp805.h>
 #include <utils.h>
+#include <xlat_tables_compat.h>
+
 #include "../../../bl1/bl1_private.h"
 
 /* Weak definitions may be overridden in specific ARM standard platform */
index e218c2f0593cfc677bb23139ce59a3cca6386f44..059c9d50d9e09fe036cf7812c9ad508388d1b746 100644 (file)
@@ -16,7 +16,7 @@
 #include <platform.h>
 #include <ras.h>
 #include <utils.h>
-#include <arm_xlat_tables.h>
+#include <xlat_tables_compat.h>
 
 /*
  * Placeholder variables for copying the arguments that have been passed to
index a21d189e9b7606df65f68a2f62a7cfa0698ed0f6..243159c776bbd67d7a3c0d25b0c077efcc9eedf4 100644 (file)
@@ -5,7 +5,6 @@
  */
 #include <arch.h>
 #include <arch_helpers.h>
-#include <arm_xlat_tables.h>
 #include <assert.h>
 #include <debug.h>
 #include <mmio.h>
@@ -14,6 +13,7 @@
 #include <platform_def.h>
 #include <romlib.h>
 #include <secure_partition.h>
+#include <xlat_tables_compat.h>
 
 /* Weak definitions may be overridden in specific ARM standard platform */
 #pragma weak plat_get_ns_image_entrypoint
index 264d5180d3a3c58e64d769f2975e93e72275ad13..50d79d422039e2f4ba30357420a9d7411cb9d878 100644 (file)
@@ -13,6 +13,7 @@
 #include <mbedtls_config.h>
 #endif
 #include <platform.h>
+#include <xlat_tables_compat.h>
 
 /*
  * The following platform functions are weakly defined. The Platforms
index 9167c9fcf840ae5f90bf2f0e41e700571d30469d..982886a9330283b04b62aa6682f5040c0f9afbc6 100644 (file)
@@ -38,24 +38,12 @@ ifeq (${ARM_ARCH_MAJOR},8)
 PLAT_INCLUDES          +=      -Iinclude/plat/arm/common/${ARCH}
 endif
 
-# Use translation tables library v2 by default
-ARM_XLAT_TABLES_LIB_V1         :=      0
-$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
-$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
-
-
 PLAT_BL_COMMON_SOURCES :=      plat/qemu/qemu_common.c                   \
                                plat/qemu/qemu_console.c                  \
                                drivers/arm/pl011/${ARCH}/pl011_console.S \
 
-ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
-PLAT_BL_COMMON_SOURCES +=      lib/xlat_tables/xlat_tables_common.c            \
-                               lib/xlat_tables/${ARCH}/xlat_tables.c
-else
 include lib/xlat_tables_v2/xlat_tables.mk
-
 PLAT_BL_COMMON_SOURCES +=      ${XLAT_TABLES_LIB_SRCS}
-endif
 
 ifneq (${TRUSTED_BOARD_BOOT},0)
 
index 376ff2f1151e2bf195b097a2fd723c590a8c49da..43a3f7012b48ee9f6f6c835f9c2fcc2573dec7bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -7,7 +7,8 @@
 #include <arch_helpers.h>
 #include <bl_common.h>
 #include <platform_def.h>
-#include <arm_xlat_tables.h>
+#include <xlat_tables_v2.h>
+
 #include "qemu_private.h"
 
 #define MAP_DEVICE0    MAP_REGION_FLAT(DEVICE0_BASE,                   \
index 33859ee5edc748cf41899740b1bc0dd2f4bf9972..35c8983cdb1928a0a3629f1cfd2ad905b2f7d74f 100644 (file)
@@ -16,10 +16,6 @@ ENABLE_SVE_FOR_NS    := 0
 
 WORKAROUND_CVE_2017_5715       :=      0
 
-ARM_XLAT_TABLES_LIB_V1         :=      1
-$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
-$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
-
 ifdef ZYNQMP_ATF_MEM_BASE
     $(eval $(call add_define,ZYNQMP_ATF_MEM_BASE))